package com.ljh.extensions.rabbit.listener;

import com.ljh.extensions.rabbit.constants.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.UnsupportedEncodingException;

/**
 * @author: Themberfue
 * @date: 2025/5/1 12:26
 * @description:
 */
@Component
public class RetryListener {
    @RabbitListener(queues = Constants.RETRY_QUEUE)
    public void process(Message message) throws UnsupportedEncodingException {
        long deliveryTag = message.getMessageProperties().getDeliveryTag();
        System.out.printf("[%s]收到消息：%s，deliveryTag：%d\n",
                Constants.RETRY_QUEUE, new String(message.getBody(), "UTF-8"), deliveryTag);
        int num = 3 / 0;
        System.out.println("业务处理完成");
    }
}
